package com.example.common.system.service.impl;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.example.common.system.dao.UserRoleDao;
import com.example.common.system.entity.UserRoleEntity;
import com.example.common.system.service.UserRoleService;
import org.springframework.stereotype.Service;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.example.common.util.PageUtils;


@Service("userRoleService")
public class UserRoleServiceImpl extends ServiceImpl<UserRoleDao, UserRoleEntity> implements UserRoleService {

    @Override
    public PageUtils queryPage(Page<UserRoleEntity> page, UserRoleEntity userRoleEntity) {
        IPage<UserRoleEntity> result = this.page(page, new QueryWrapper<UserRoleEntity>(userRoleEntity));

        return new PageUtils(result.getRecords(),
                result.getTotal(),
                result.getSize(),
                result.getPages());
    }

}